<!DOCTYPE html>
<html lang="en" style="width: 100%;height: 100%;">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body style="width: 100%;height: 100%;">
    <div id="main" style="width: 600px;height:400px;"></div>

    <script src="http://echarts.baidu.com/vendors/jquery/jquery.min.js"></script>
    <script src="http://echarts.baidu.com/dist/echarts.min.js"></script>

    <script type="text/javascript">
        $(function () {
            var myChart = echarts.init(document.getElementById('main'));
            $.ajax({
                url:'/getData',
                dataType:'json',
                success:function(data)
                {
                    console.log(data);
                    var option = {
                        title: {
                            text: '公司类型与薪资关系'
                        },
                        tooltip : {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'cross',
                                label: {
                                    backgroundColor: '#6a7985'
                                }
                            }
                        },
                        legend: {
                            data:['最大薪资','平均薪资','最小薪资']
                        },
                        toolbox: {
                            feature: {
                                saveAsImage: {}
                            }
                        },
                        grid: {
                            left: '3%',
                            right: '4%',
                            bottom: '3%',
                            containLabel: true
                        },
                        xAxis : [
                            {
                                type : 'category',
                                boundaryGap : false,
                                data : data.gsxz_name
                            }
                        ],
                        yAxis : [
                            {
                                type : 'value'
                            }
                        ],
                        series : [
                            {
                                name:'最大薪资',
                                type:'line',
                                stack: '总量',
                                areaStyle: {normal: {}},
                                data:data.max_zwyx
                            },
                            {
                                name:'平均薪资',
                                type:'line',
                                stack: '总量',
                                areaStyle: {normal: {}},
                                data:data.avg_zwyx
                            },
                            {
                                name:'最小薪资',
                                type:'line',
                                stack: '总量',
                                areaStyle: {normal: {}},
                                data:data.min_zywx
                            }
                        ]
                    };
                    myChart.setOption(option);
                }
            })
        })
    </script>
</body>
</html>